package com.sun.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Project: hospitalDrugInformationManagement
 * @Author: 86178
 * @Date: 2023/3/30 14:19
 * @FileName: Log
 * @Description: ""
 */
@Accessors(chain = true)
@TableName("log")
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuppressWarnings("all")
//普通单元格的高度
@ContentRowHeight(26)
//头部单元格的高度
@HeadRowHeight(30)
//普通单元格的字体大小
@ContentFontStyle(fontHeightInPoints = 12)
public class Log extends Model<Log> {
    @ColumnWidth(30)
    @NumberFormat(value = "#")
    @ExcelProperty(value = "用户编号", converter = LongStringConverter.class)
    @TableId()
    private Long id;
    @ColumnWidth(30)
    @ExcelProperty("登录时间")
    private LocalDateTime dateTime;
    //登录账户
    @ColumnWidth(25)
    @ExcelProperty("登录账户")
    private String account;

    @ColumnWidth(30)
    @ExcelProperty("ip地址")
    private String ip;
    //用户id
    @ColumnWidth(30)
    @ExcelProperty("用户ID")
    private Long userId;
    //0成功，1失败
    @ColumnWidth(20)
    @ExcelProperty("状态")
    private String result;

    //用户名
    @ColumnWidth(25)
    @ExcelProperty("用户名")
    private String userName;
    //电话
    @ColumnWidth(25)
    @ExcelProperty("电话")
    private String tel;
    //结果的描述
    @ColumnWidth(30)
    @ExcelProperty("结果描述")
    private String logRemark;

    //登录方式：账号登录，短信登录
    @ColumnWidth(30)
    @ExcelProperty("登录方式")
    private String type;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
